Skip to content

Translate 'Test Utils' page #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 7, 2019

Conversation

jakubdrozdek
Copy link
Member

No description provided.

@jakubdrozdek jakubdrozdek added the needs review A pull request ready to be reviewed label Feb 20, 2019
@jakubdrozdek jakubdrozdek added this to the Core Pages milestone Feb 20, 2019
@netlify
Copy link

netlify bot commented Feb 20, 2019

Deploy preview for pl-reactjs ready!

Built with commit 059fc78

https://deploy-preview-21--pl-reactjs.netlify.com

@netlify
Copy link

netlify bot commented Feb 20, 2019

Deploy preview for pl-reactjs ready!

Built with commit 7e3237d

https://deploy-preview-21--pl-reactjs.netlify.com

@jakubdrozdek jakubdrozdek force-pushed the addons-test-utils branch 2 times, most recently from 2131c2d to 3f7f1fe Compare February 22, 2019 22:56
Copy link
Member

@cvqprs cvqprs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dodałem jeden komentarz, cała reszta super!

@cvqprs cvqprs added the needs +1 Needs another approval before merging label Feb 28, 2019
Copy link
Contributor

@marcinostrouch marcinostrouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kilka sugestii natury kosmetycznej


`ReactTestUtils` makes it easy to test React components in the testing framework of your choice. At Facebook we use [Jest](https://facebook.github.io/jest/) for painless JavaScript testing. Learn how to get started with Jest through the Jest website's [React Tutorial](https://jestjs.io/docs/tutorial-react).
`ReactTestUtils` pozwala na łatwiejsze testowanie komponentów reactowych przy pomocy dowolnego frameworka. W Facebooku korzystamy do tego celu z biblioteki [Jest](https://facebook.github.io/jest/), która sprawia, że pisanie testów jest mniej kłopotliwe. Do nauki podstaw Jesta polecamy artykuł pt. ["Samouczek dla Reacta"](https://jestjs.io/docs/tutorial-react), znajdujący się na oficjalnej stronie biblioteki.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Na stronie Jesta (https://jestjs.io/docs/tutorial-react) zdaje się nie ma polskiej wersji językowej samouczka. Może więc powinniśmy zostawić tu tytuł w oryginale ewentualnie z dopiskiem (pol. Samouczek dla Reacta)?

>
> We recommend using [`react-testing-library`](https://git.io/react-testing-library) which is designed to enable and encourage writing tests that use your components as the end users do.
> Zalecamy korzystanie z biblioteki [`react-testing-library`](https://git.io/react-testing-library). Została on stworzona w celu propagowania idei pisania testów, które używają komponentów podobnie jak potencjalny użytkownik aplikacji.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Zalecamy korzystanie z biblioteki [`react-testing-library`](https://git.io/react-testing-library). Została on stworzona w celu propagowania idei pisania testów, które używają komponentów podobnie jak potencjalny użytkownik aplikacji.
> Zalecamy korzystanie z biblioteki [`react-testing-library`](https://git.io/react-testing-library). Została ona stworzona w celu propagowania idei pisania testów, które używają komponentów podobnie jak potencjalny użytkownik aplikacji.

>
> Alternatively, Airbnb has released a testing utility called [Enzyme](https://airbnb.io/enzyme/), which makes it easy to assert, manipulate, and traverse your React Components' output.
> Jako alternatywę, firma Airbnb opublikowała narzędzie do testowania o nazwie [Enzyme](https://airbnb.io/enzyme/), które pozwala na łatwe pisanie asercji, a także manipulowanie i przechodzenie drzewa zwróconego przez komponenty reactowe.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Czy "przechodzenie drzewa" jest utartym wyrażeniem? Jeśli nie to może po prostu "poruszanie się po drzewie zwróconym"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


### `act()` {#act}

To prepare a component for assertions, wrap the code rendering it and performing updates inside an `act()` call. This makes your test run closer to how React works in the browser.
Aby przygotować komponent do testowania, należy kod renderujący i aktualizujący go "opakować" w wywołanie funkcji `act()`. Dzięki temu test zostanie uruchomiony w taki sposób, aby jak najwierniej odtworzyć zachowanie Reacta w przeglądarce.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Aby przygotować komponent do testowania, należy kod renderujący i aktualizujący go "opakować" w wywołanie funkcji `act()`. Dzięki temu test zostanie uruchomiony w taki sposób, aby jak najwierniej odtworzyć zachowanie Reacta w przeglądarce.
Aby przygotować dany komponent do testowania, należy renderujący i aktualizujący go kod "opakować" w wywołanie funkcji `act()`. Dzięki temu test zostanie uruchomiony w taki sposób, aby jak najwierniej odtworzyć zachowanie Reacta w przeglądarce.

});
```

Don't forget that dispatching DOM events only works when the DOM container is added to the `document`. You can use a helper like [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) to reduce the boilerplate code.
Zwróć uwagę, że przesyłanie zdarzeń DOM działa tylko wtedy, gdy kontener jest umieszczony w `document`. Możesz w tym celu użyć biblioteki pomocniczej, jak na przykład [`react-testing-library`](https://github.com/kentcdodds/react-testing-library), aby zredukować powtarzający się szablonowy kod.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Zwróć uwagę, że przesyłanie zdarzeń DOM działa tylko wtedy, gdy kontener jest umieszczony w `document`. Możesz w tym celu użyć biblioteki pomocniczej, jak na przykład [`react-testing-library`](https://github.com/kentcdodds/react-testing-library), aby zredukować powtarzający się szablonowy kod.
Zwróć uwagę, że przesyłanie zdarzeń DOM działa tylko wtedy, gdy kontener jest umieszczony w `document`. Aby uniknąć powtarzania szablonowego kodu, możesz użyć biblioteki pomocniczej, jak na przykład [`react-testing-library`](https://github.com/kentcdodds/react-testing-library), .

@@ -221,7 +221,7 @@ scryRenderedDOMComponentsWithClass(
)
```

Finds all DOM elements of components in the rendered tree that are DOM components with the class name matching `className`.
Wyszukuje wszystkie elementy DOM w wyrenderowanym drzewie, których nazwa klasy CSS pasuje do wartości argumentu `className`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Wyszukuje wszystkie elementy DOM w wyrenderowanym drzewie, których nazwa klasy CSS pasuje do wartości argumentu `className`.
Wyszukuje wszystkie elementy DOM w wyrenderowanym drzewie, których nazwa klasy CSS odpowiada wartości argumentu `className`.

@jakubdrozdek jakubdrozdek merged commit 71c2416 into reactjs:master Mar 7, 2019
@jakubdrozdek jakubdrozdek deleted the addons-test-utils branch March 7, 2019 14:51
@jakubdrozdek jakubdrozdek added 🌐 translated Translation is completed for this page and removed needs +1 Needs another approval before merging needs review A pull request ready to be reviewed labels Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌐 translated Translation is completed for this page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants